#include <iostream>
#include <string>
using namespace std;

int main() {
    int n, sum = 0;
    string T;
    cin >> n >> T;
    for (int i = 0; i < n; ++i) {
        char ch = T[i];
        if (ch >= 'a' && ch <= 'z') {
            sum += ch - 'a' + 1; // 小写字母加正整数
        } else if (ch >= 'A' && ch <= 'Z') {
            sum += -int(ch);     // 大写字母加负ASCII码
        }
    }
    cout << sum << endl;
    return 0;
}
